]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
endSessionDialog: Use DialogType constants instead of magic numbers
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 11 Sep 2014 13:55:07 +0000 (14:55 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 11 Sep 2014 14:04:46 +0000 (15:04 +0100)
js/ui/endSessionDialog.js

index 7222f6eebae2a6cbc1dc7966b326c118057099e8..94ff4a35a428994ce430cc35adf3a3ee7179057c 100644 (file)
@@ -134,11 +134,18 @@ const restartInstallDialogContent = {
     showOtherSessions: true,
 };
 
+const DialogType = {
+  LOGOUT: 0 /* GSM_SHELL_END_SESSION_DIALOG_TYPE_LOGOUT */,
+  SHUTDOWN: 1 /* GSM_SHELL_END_SESSION_DIALOG_TYPE_SHUTDOWN */,
+  RESTART: 2 /* GSM_SHELL_END_SESSION_DIALOG_TYPE_RESTART */,
+  UPDATE_RESTART: 3
+};
+
 const DialogContent = {
-    0 /* GSM_SHELL_END_SESSION_DIALOG_TYPE_LOGOUT */: logoutDialogContent,
-    1 /* GSM_SHELL_END_SESSION_DIALOG_TYPE_SHUTDOWN */: shutdownDialogContent,
-    2 /* GSM_SHELL_END_SESSION_DIALOG_TYPE_RESTART */: restartDialogContent,
-    3: restartInstallDialogContent
+    DialogType.LOGOUT: logoutDialogContent,
+    DialogType.SHUTDOWN: shutdownDialogContent,
+    DialogType.RESTART: restartDialogContent,
+    DialogType.UPDATE_RESTART: restartInstallDialogContent
 };
 
 const MAX_USERS_IN_SESSION_DIALOG = 5;
@@ -677,8 +684,9 @@ const EndSessionDialog = new Lang.Class({
         this._totalSecondsToStayOpen = totalSecondsToStayOpen;
         this._type = type;
 
-        if (this._type == 2 && this._updatesFile.query_exists(null))
-            this._type = 3;
+        if (this._type == DialogType.RESTART &&
+            this._updatesFile.query_exists(null))
+            this._type = DialogType.UPDATE_RESTART;
 
         this._applications = [];
         this._applicationList.destroy_all_children();